<?php
//初始化文件
include '../../init.php';
//数据库文件
include DIR_CORE.'mysql.php';

//题库统计
$sql = "select t1.single,t2.multiple,t3.fill,t4.judge from 
  (select count(*) single from single) t1,
  (select count(*) multiple from multiple) t2,
	(select count(*) fill from fill) t3,
  (select count(*) judge from judge) t4";

 $res = mysqli_query($link, $sql);
 $row = mysqli_fetch_assoc($res);

 //成绩统计
$sql1 = "select count(*) as '优秀' from score where score >=90";
$sql2 = "select count(*) as '良好' from score where score between 70 and 89";
$sql3 = "select count(*) as '及格' from score where score between 60 and 100";
$sql4 = "select count(*) as '不及格' from score where score between 0 and 59";
$sql5 = "select count(*) as '差' from score where score between 0 and 30";
$res1 = mysqli_query($link, $sql1);
$res2 = mysqli_query($link, $sql2);
$res3 = mysqli_query($link, $sql3);
$res4 = mysqli_query($link, $sql4);
$res5 = mysqli_query($link, $sql5);

$row1 = mysqli_fetch_assoc($res1);
$row2 = mysqli_fetch_assoc($res2);
$row3 = mysqli_fetch_assoc($res3);
$row4 = mysqli_fetch_assoc($res4);
$row5 = mysqli_fetch_assoc($res5);

$data = array_merge($row, $row1, $row2, $row3, $row4, $row5);

 echo json_encode($data);
